using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Graphe;

namespace Graphe.WPF
{
    /// <summary>
    /// Interaction logic for Jump.xaml
    /// </summary>

    public partial class Jump : System.Windows.Window
    {

        public Jump(Document manuscript)
        {
            InitializeComponent();

            Manuscript = manuscript;

            Loaded += new RoutedEventHandler(Jump_Loaded);
        }

        void Jump_Loaded(object sender, RoutedEventArgs e)
        {
            Binding binding = new Binding();
            binding.Source = Manuscript.IndexItems;
            _listBoxIndexes.DisplayMemberPath = "Name";
            _listBoxIndexes.SetBinding(ListBox.ItemsSourceProperty, binding);
        }

        public Document Manuscript { get; set; }
        public int ImageNumber { get; set; }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            IndexItem item = _listBoxIndexes.SelectedItem as IndexItem;
            ImageNumber = item.ImageNumber;

            Close();
        }

    }
}